package com.bjsxt.shop.common.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import com.bjsxt.shop.common.util.DateFormatUtil;
import com.bjsxt.shop.common.util.PageInfoUtil;

/**
 * 所有Controller的父类
 * 
 * @author haihai
 *
 */
public class BaseController
{	
	@Resource
	protected DateFormatUtil dateFormatUtil;
	/* 提示信息 */
	protected String info;
	/**
	 * 从Request中封装分页信息
	 * 所有的列表页面都要分页
	 * @param request
	 * @return
	 */
	protected PageInfoUtil proccedPageInfo(HttpServletRequest request)
	{
		PageInfoUtil pageInfoUtil = new PageInfoUtil();
		try
		{
			String currentPage = request.getParameter("currentPage");
			String pageSize = request.getParameter("pageSize");
			pageInfoUtil.setCurrentPage(Integer.valueOf(currentPage));
			pageInfoUtil.setPageSize(Integer.valueOf(pageSize));
		} catch (Exception e)
		{
		}
		return pageInfoUtil;
	}
}
